Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Scripting Additions Guide /
Chapter 2 - Scripting Addition Commands / Command Definitions
/


Set EOF

The Set EOF sets the end of a specified file. It is one of several commands provided by the Read/Write Commands scripting addition. For more information about these commands, see "Using Read/Write Commands,".

SYNTAX
set eof referenceToFile to integer
PARAMETERS
referenceToFile
A reference of the form file nameString or alias nameString, or a file reference number returned by a previous call to the Open for Access command.
Class: Reference or integer

integer
The number of bytes to which to set the offset of the end of
the file.
Class: Integer
RESULT
None

EXAMPLE
set eof file "Hard Disk:Status Reports:Weekly Report" to 10
NOTES
To specify the name (nameString) of a file, use a string of the form "Disk:Folder1:
Folder2:...:Filename"
as described in Chapter 5, "Objects and References,"
of the AppleScript Language Guide. If you specify only the name of the file (Filename) instead of its entire pathname, AppleScript attempts to find the file in the current directory.

If you specify a reference to a file or an alias, the Set EOF command attempts to match the reference with a file previously opened (with write permission) with the Open for Access command. If the file was previously opened with read permission only, Set EOF returns the error code -61. If a match is found, Set EOF sets the end of the file as specified. If no match is found, Set EOF opens the file, sets the end of the file, then closes the file.

If you specify a file reference number previously obtained (with write permission) with the Open for Access command, Set EOF sets the end of
the file immediately.

IMPORTANT
If the file is longer than the end of file set by Set EOF, it is truncated to the specified size and any additional data is lost. If the file is shorter than the end of file set by Set EOF, it is extended to the new length, but the additional data in the new part of the file is meaningless.
ERRORS
Error
number
Error message
-34Disk <name> is full.
-38File <name> wasn't open.
-44Disk <name> is write protected.
-45File <name> is locked.
-46Disk <name> is locked.
-50Parameter error.
-51File reference number error.
-61File not open with write permission.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
18 DEC 1996